const mongoose = require('mongoose');
const {mongoDBport,localurl} = require('../config/config.default')
async function main() {
    await mongoose.connect(`mongodb://${localurl}${mongoDBport}`);
}

main().then(()=>{
    console.log('数据库链接成功')
}).catch((err)=>{
    console.log('数据库链接失败',err)
})


module.exports = {
    useModel:mongoose.model('User',require('./userModel')),
    videoModel:mongoose.model('Video',require('./videoModel')),
    subscribeModel:mongoose.model('Subscribe',require('./subscribeModel')),
    commentModel:mongoose.model('VideoComments',require('./commentModel')),
    likeModel:mongoose.model('Videolike',require('./likeModel'))
}